<?php

/**
 * GofishGirls form.
 *
 * @package    gofish
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class GofishGirlsForm extends BaseGofishGirlsForm
{
  public function configure()
  {
      unset (
          $this['total_points'],
          $this['created_at'],
          $this['updated_at']
      );
      
      //$this->setWidget('total_points', new sfWidgetFormInputHidden());
      $this->setWidget('user_id', new sfWidgetFormInputHidden());
      $this->setWidget('group_id', new sfWidgetFormInputHidden());
      
  }
  
  public function doSave($con = null)
      {
          $retval = parent::doSave($con);
          $player = $this->getObject()->getGofishPlayer()->updateGirlCountAndPoints();
          //$player->setPoints($player->getPoints() + $this->getObject()->getTotalPoints());
          //$player->setGirls($player->getGirls() + 1);
          //echo $player->getPoints() . ' + ' . $this->getObject()->getTotalPoints();
            // or should we call a function from the player (ex: $player->updatepoints) and that function recounts all the girls & their points?
          return $retval;
      }
}
